<?php

use Illuminate\Routing\Router;

Admin::routes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
    'as'            =>  '',
], function (Router $router) {
    $router->get('/', 'HomeController@storeDetail')->name('home');
    
    $router->resources([
        'storeys'=>StoreysController::class,
        'scale'=>ScaleController::class,
        'room'=>RoomController::class,
        'businesstime'=>BusinessTimeController::class,
        'setmeal'=>SetMealController::class,
        'pattern'=>PatternController::class,
        'store-goods'=>GoodsController::class,
        'goods-classifies'=>GoodsClassifyController::class,
        'news'=>NewsController::class,
        'cashiers' => CashierController::class,
        'configs' => ConfigController::class,
        'banners' => BannerController::class,
        'admin-users' => AdminUserController::class,
        'storages' => StorageController::class,
        'record-storages' => RecordStorageController::class,
        'record-goods' => RecordGoodsController::class,
        'record-balances' => RecordBalanceConctroller::class,
        //'orders' => OrderController::class,
        'members' => MemberController::class,
        'record-recharges' => RecordRechargeConctroller::class,
        'member-levels' => MemberLevelController::class,
        'coupons' => CouponController::class,
        'point-goods' => PointGoodsController::class,
        'purchases' => PurchaseController::class,
        'materials' => MaterialController::class,
        'record-materials' => RecordMaterialController::class,
        'point-goods-orders' => PointGoodsOrderController::class,
	    'classifies' => ClassifyController::class,
	    'keys' => KeyController::class,
	    'values' => ValueController::class,
	    'staffs' => StaffController::class,
	    'departments' => DepartmentController::class,
	    'filters' => FilterController::class,
	    'staff-practices' => RecordStaffPracticeController::class,
	    'sharps' => SharpController::class,
	    'sharp-goods-sku' => SharpGoodsSkuController::class,
	    'sharp-goods' => SharpGoodsController::class,
	    'print-areas' => PrintAreaController::class,
	    'store-withdrawals' => StoreWithdrawalController::class,
    ], ['only' => ['index', 'edit', 'update', 'create', 'destroy', 'store']]);

    $router->resource('storedetails','StoreDetailsController',
	    ['only' => ['edit', 'update']]);
    $router->resource('orders', 'OrderController',
	    ['except' => ['create', 'update']]);
    // 秒杀路由注册
//    $router->resource('sharps', 'SharpController',
//	    ['only' => ['index', 'destroy']]);
//    $router->get('sharps/{$id}/edit', 'SharpController@editSharp')->name('sharp.edit');
//    $router->match(['put', 'patch'], 'sharps/{$id}', 'SharpController@update')
//	    ->name('sharp.update');
    
	// 打印机设置
	$router->get('reception-machine', 'ReceptionMachineController@index')->name('receptionMachine.index');
	$router->post('reception-machine', 'ReceptionMachineController@EditReceptionMachine')->name('receptionMachine.edit');
	// 供应商编号
    $router->post('supplier/get_supplierno', 'SupplierController@get_supplierno');
	// 商品编号
	$router->post('goods/goodsNumber', 'GoodsController@goodsNumber')->name('goodsNumber');
	$router->post('staff/get-staffno', 'StaffController@staffNo')->name('staffNo');
    // 门店详情
    $router->get('/storedetail', 'StoreDetailsController@storeDetail')->name('storeDetail');
    $router->get('/dashboard', 'HomeController@index');
    
    // 图表统计
	$router->get('goods-chart', 'Chart\GoodsChartController@index')->name('goodsChart');
	$router->get('order-chart', 'Chart\OrderChartController@index')->name('orderChart');
	$router->get('room-chart', 'Chart\RoomChartController@index')->name('roomChart');
	$router->get('turnover-chart', 'Chart\TurnoverChartController@index')->name('turnoverChart');
	$router->get('daily-chart', 'Chart\DailyChartController@index')->name('dailyChart');
    $router->get('material-chart', 'Chart\MaterialChartController@index')->name('materialChart');
	// 导出
	$router->get('material-export', 'Export\MaterialExportController@index')->name('materialExport.index');
	$router->any('material-export-post', 'Export\MaterialExportController@export')->name('stockExport');
//	$router->get('member-export', 'Export\MemberExportController@index')->name('memberExport.index');
//	$router->any('member-export-post', 'Export\MemberExportController@export')->name('memberExport');
	$router->get('room-export', 'Export\RoomExportController@index')->name('roomExport.index');
	$router->any('room-export-post', 'Export\RoomExportController@export')->name('roomExport');
	$router->get('goods-export', 'Export\GoodsExportController@index')->name('goodsExport.index');
	$router->any('goods-export-post', 'Export\GoodsExportController@export')->name('goodsExport');
	$router->get('order-export', 'Export\OrderExportController@index')->name('orderExport.index');
	$router->any('order-export-post', 'Export\OrderExportController@export')->name('orderExport');
	$router->get('turnover-export', 'Export\TurnoverExportController@index')->name('turnoverExport.index');
	$router->any('turnover-export-post', 'Export\TurnoverExportController@export')->name('turnoverExport');
	$router->get('daily-export', 'Export\DailyExportController@index')->name('dailyExport.index');
	$router->any('daily-export-post', 'Export\DailyExportController@export')->name('dailyExport');
	// 排班导入
	$router->get('schedule', 'Imports\ScheduleImportController@index')->name('schedule.index');
	$router->post('schedule', 'Imports\ScheduleImportController@Import')->name('schedule.import');
	// 考勤导入
	$router->get('attendance', 'Imports\AttendanceController@index')->name('attendance.index');
	$router->post('attendance', 'Imports\AttendanceController@import')->name('attendance.import');
    // 总后台特有设置
    $router->get('distributor-levels', 'Distributor@index');
    $router->get('distributors', 'Distributor@index');
    $router->get('distributor-applies', 'Distributor@index');
    $router->get('distributor-banks', 'Distributor@index');
    $router->get('distributor-withdrawals', 'Distributor@index');
    $router->get('member-chart', 'Distributor@index');
    
    //  商品属性
	//  $router->get('goods', 'Attribute\GoodsAttributeController@index')->name('attr');
    //	$router->get('goods/lists', 'Attribute\GoodsAttributeController@lists')->name('attr.lists');
    //	$router->get('goods/create', 'Attribute\GoodsAttributeController@create')->name('attr.create');
    //	$router->post('goods/store', 'Attribute\GoodsAttributeController@store')->name('attr.store');
    //	$router->post('goods/delete', 'Attribute\GoodsAttributeController@delete')->name('attr.delete');
    //	$router->get('goods/edit/{id}', 'Attribute\GoodsAttributeController@edit')->name('attr.edit');
	$router->post('goods/update', 'Attribute\GoodsAttributeController@update')->name('attr.update');
	$router->get('goods/attribute/{id}', 'Attribute\GoodsAttributeController@attribute')->name('attr.attr');
	$router->post('goods/value_add', 'Attribute\GoodsAttributeController@value_add')->name('attr.value_add');
	$router->get('goods-sku/{id}/material', 'Attribute\GoodsAttributeController@material')->name('goodsSku.material');
	// 属性材料
	$router->post('getMaterials', 'Attribute\GoodsAttributeController@getMaterials')->name('getMaterials');
	$router->post('updateMaterials', 'Attribute\GoodsAttributeController@updateMaterials')->name('updateMaterials');
	$router->post('removeMaterials', 'Attribute\GoodsAttributeController@removeMaterials')->name('removeMaterials');
	
	// 选择商品分类获取秒杀商品
	$router->post('getGoodsSku', 'SharpGoodsSkuController@getGoods')->name('getGoods');
	$router->post('getSku', 'SharpGoodsSkuController@getSku')->name('getSku');
	$router->post('getGoods', 'SharpGoodsController@getGoods')->name('getNoSkuGoods');
	
	// 覆盖laravel admin默认路由
	$router->resource('auth/users', 'AdminUserController')->names('admin.auth.users');
	$router->resource('auth/roles', 'AdminRolesController')->names('admin.auth.roles');
});
